﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Splicer.Timeline;
using System.Drawing;
using Splicer.Renderer;
using Splicer.WindowsMedia;

namespace Test
{
    public static class VideoCreater
    {
        public static void CreateVideo(string path)
        {
            string[] files = Directory.GetFiles(path);

            // generates a little slide-show, with audio track and fades between images.

            string outputFile = @"C:\Users\admin\Desktop\Video.wmv";

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup group = timeline.AddVideoGroup(32, 600, 600);

                ITrack videoTrack = group.AddTrack();

                for (int i = 0; i < files.Length; i++)
                {
                    Image img = Image.FromFile(files[i]);
                    videoTrack.AddImage(img, 0, 0.07); // play first image for a little while
                }

                ITrack audioTrack = timeline.AddAudioGroup().AddTrack();

                IRenderer renderer =
                      new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo);

                renderer.Render();

            }
        }
    }
}
